<template>
    <div>
        <div class="gobackBox flex flex-align-center">
            <div class="goback flex flex-align-center" @click="onGoBockFun">
                 <img src="@/assets/img/arrow-left.png" alt="">
                 <p>返回</p>
            </div>
        </div>
    </div>
</template>
<script>
export default {
   data () {
       return {
       }
   },
   props: {
      location:{
          type:String,
          default:null,
      } 
   },
   methods: {
        //  若父组件传入返回地址 则跳转到该地址，
        //  若未传入地址，则返回上一个浏览器地址
       onGoBockFun(){
           if(this.location != null){
              if(this.$store.state.userInfo.use_end_time == '1970/01/01 08:00:00' 
                    && this.$store.state.userInfo.is_expire == 1 
                    && this.location == '/usercenter'){
              }else{
                   this.$router.push(this.location);
              }
           }else{
               window.history.go(-1);
           }
       }
   }
}
</script>
<style lang="less" scoped>
@import url(../assets/css/public.less);
@import url(../assets/css/goback.less);
</style>


